<?php echo $this->fetch('header.html'); ?>
<div>
  <ul class="nav nav-tabs">
    <li><a href="<?php echo $this->_var['appadmin']; ?>?m=kucun">库存管理</a></li>
    <li class="active"><a href="#">库存授权</a></li>
  </ul>
  <div>当前库存：<?php echo $this->_var['kucun']['title']; ?></div>
  
  
  <style>
  .sclist{}
  .sclist .hd{width:100%; height:30px; line-height:30px; border-bottom:1px solid #ccc; margin-bottom:5px;}
  .sclist .item{width:100%; margin-bottom:10px;}
  .sclist .item .scity{text-align:center; width:100px; cursor:pointer; float:left; margin-right:10px;}
  .sclist .item .scity.active{background-color:#E0A421; color:#fff;}
  </style>
  <div class="sclist">
  	
   <div class="hd">站点列表</div>
    <div class="item">
    	 
       <?php $_from = $this->_var['sclist']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
        <div  class="scity <?php if ($this->_var['c']['isdo']): ?> active <?php endif; ?>" scid="<?php echo $this->_var['c']['siteid']; ?>"><?php echo $this->_var['c']['sitename']; ?></div>
        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        
        <div class="clearfix"></div>
    </div>
   
  </div>
</div>
<script>
$(function(){
	$(".scity").on("click",function(){
		var  obj=$(this);
		var qx=0;
		var url;
		if($(this).hasClass("active")){
			url="<?php echo $this->_var['appadmin']; ?>?m=kucun_area&ajax=1&a=qxshouquan";
			qx=1;
		}else{
			url="<?php echo $this->_var['appadmin']; ?>?m=kucun_area&ajax=1&a=shouquan";
		}
		$.get(url,{kcid:<?php echo $this->_var['kucun']['kcid']; ?>,siteid:$(this).attr("scid")},function(data){
			if(data.error){
				skyToast(data.message);
			}else{
				if(qx==1){
					obj.removeClass("active");
				}else{
					obj.addClass("active");
				}
			}
		},"json")
	});
});
</script>
<?php echo $this->fetch('footer.html'); ?>